/*
 *
 *  Copyright (C) 2010 Tal Eisenberg
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package tal.drivechain.gui;

import java.awt.GridBagConstraints;

/**
 * Represents a GridBagConstraints object that responds to equals()
 * This class is always used as the value of the layout property
 * @author eisental
 */
public class dcLayout extends GridBagConstraints {

    public static dcLayout createNewLayout() {
        dcLayout ret = new dcLayout();
        ret.fill = dcLayout.BOTH;
        ret.weightx = 1.0;
        ret.weighty = 1.0;
        return ret;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof dcLayout) {
            if (super.equals(obj)) return true;
            else {
                GridBagConstraints that = (GridBagConstraints)obj;
                if (this.anchor!=that.anchor) return false;
                if (this.fill!=that.fill) return false;
                if (this.gridheight!=that.gridheight) return false;
                if (this.gridwidth!=that.gridwidth) return false;
                if (this.gridx!=that.gridx) return false;
                if (this.gridy!=that.gridy) return false;
                if (this.insets.bottom!=that.insets.bottom) return false;
                if (this.insets.left!=that.insets.left) return false;
                if (this.insets.right!=that.insets.right) return false;
                if (this.insets.top!=that.insets.top) return false;
                if (this.ipadx!=that.ipadx) return false;
                if (this.weightx!=that.weightx) return false;
                if (this.weighty!=that.weighty) return false;
                return true;
            }
        } else return false;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

}
